/**
 * 添加水印
 * @param {*} staffCode 员工编号
 * @param {*} userName 员工姓名
 * @param {*} container 容器
 * @param {*} height 高度
 */
export default function(staffCode,userName,container,height) {
    //水印
    let can = document.createElement('canvas');
    can.width = 200;
    can.height = 120;
    can.style.display = 'none';
    can.style.zIndex = '999';
    let cans = can.getContext('2d');
    //旋转
    cans.rotate(-0.5);
    cans.globalAlpha = 0.1;
    cans.font = "800 16px Microsoft Yahei";
    cans.fillStyle = "#000";
    cans.fillStyle = 'rgba(10, 10, 10, .5)';
    cans.textAlign = 'center';
    cans.font = "800 15px Microsoft JhengHei";
    cans.fillText(staffCode, 50, 110);
    cans.fillText(userName, 50, 130);
    let _styles = `width:100%;max-width: 750px;min-width: 320px;height:${height}px;background-image:url(${can.toDataURL("image/png", 1)});
    background-repeat:repeat;pointerEvents:none;z-index:99;position:fixed;left:50%;top:85px;bottom:120px;right:0;overflow: hidden;transform: translateX(-50%);`;
    let warterHtml = document.createElement('div');
    warterHtml.setAttribute('id','sy');
    warterHtml.style.cssText = _styles;
    container.appendChild(warterHtml);
}